package io.renren.modules.avanotes.controller;

import java.util.Arrays;
import java.util.Map;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.avanotes.entity.*;
import io.renren.modules.avanotes.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import springfox.documentation.annotations.ApiIgnore;


/**
 * 专题标签表
 *
 * @author zzr
 * @email 529742454@qq.com
 * @date 2022-02-19 15:17:28
 */
@RestController
@RequestMapping("avanotes/sstag")
//@Api("专题标签表接口")
public class SsTagController {
    @Autowired
    private SsTagService ssTagService;

    /**
     * 列表
     */
    @PostMapping("/list")
    //@RequiresPermissions("avanotes:sstag:list")
    //@ApiImplicitParams({
    //        @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "String"),
    //        @ApiImplicitParam(name = "limit", value = "每页记录数", paramType = "query", dataType = "String"),
    //        @ApiImplicitParam(name = "key", value = "检索关键字", paramType = "query", dataType = "String")
    //})
    //@ApiOperation("查询列表")
    public R list(@ApiIgnore @RequestParam Map<String, Object> params) {
        PageUtils page = ssTagService.queryPage(params);

        //return R.ok().put("page", page);
        return R.ok().setData(page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("avanotes:sstag:info")
    //@ApiOperation("查询单条")
    public R info(@PathVariable("id") Integer id) {
            SsTagEntity ssTag = ssTagService.getById(id);

        //return R.ok().put("ssTag", ssTag);
        return R.ok().setData(ssTag);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("avanotes:sstag:save")
    //@ApiOperation("保存")
    public R save(@RequestBody SsTagEntity ssTag) {
            ssTagService.save(ssTag);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("avanotes:sstag:update")
    //@ApiOperation("修改")
    public R update(@RequestBody SsTagEntity ssTag) {
            ssTagService.updateById(ssTag);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("avanotes:sstag:delete")
    //@ApiOperation("删除")
    public R delete(@RequestBody Integer[] ids) {
            ssTagService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
